fix(claude): preserve marketplace source shape for allowlist matching#345
Open
abezzub-dr wants to merge 2 commits into
Open
fix(claude): preserve marketplace source shape for allowlist matching#345abezzub-dr wants to merge 2 commits into
abezzub-dr wants to merge 2 commits into
Conversation
Marketplace entries like {source: github, repo: owner/repo} were being
rewritten to {source: git, url: https://github.com/owner/repo.git} in
LoadSettings, LoadKnownMarketplaces, and ConfigToSettings before being
written into the container's settings.json and known_marketplaces.json.
When a host ~/.claude/remote-settings.json declares strictKnownMarketplaces
(an exact-match allowlist of {source, repo|url} pairs that moat copies
into the container), the normalized form no longer matched the shape the
host had registered with, so Claude Code inside the container rejected
every plugin install with "Marketplace ... is not in the allowed
marketplace list" — even though plain `claude` on the host worked.
Stop normalizing at those three sites and pass the original source shape
through. Update the manager.go extraction loop to switch on
entry.Source.Source and copy either Repo (github) or URL (git) into
MarketplaceConfig.Repo. Downstream consumers (GenerateKnownMarketplaces,
CloneMarketplace, `claude plugin marketplace add`) already accept either
form, so no changes are needed there.
Update existing tests that locked in the old normalized output to assert
the preserved shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{source: github, repo: X}marketplace entries to{source: git, url: https://github.com/X.git}inLoadSettings,LoadKnownMarketplaces, andConfigToSettings. Pass the original source shape through to the container.internal/run/manager.goto handle both{Source: github, Repo}and{Source: git, URL}entries when populatingMarketplaceConfig.Why
When a host's
~/.claude/remote-settings.jsondeclaresstrictKnownMarketplaces— an exact-match allowlist of{source, repo|url}pairs that moat copies into the container (#306) — the normalized form no longer matched the shape the host was registered with. Claude Code inside the container rejected every plugin install withMarketplace "X" is not in the allowed marketplace list, even though plainclaudeon the host worked because itsknown_marketplaces.jsonregistration matched the allowlist'sgithub+repoentry.Concretely, the bug path:
LoadSettingsrewrote{source: github, repo: company-name/claude-marketplace}→{source: git, url: https://github.com/digitalroute/dr-claude-marketplace.git}.manager.gothen stripped the URL back tocompany-name/claude-marketplaceforMarketplaceConfig.Repo, but keptSource: "git".GenerateKnownMarketplacessawSource == "git"and wrote{source: git, url: "company-name/claude-marketplace"}into the container'sknown_marketplaces.json— a path stuffed into a URL field, matching neither allowlist entry.Preserving the original shape end-to-end avoids the lossy conversion entirely. Downstream consumers (
GenerateKnownMarketplaces,CloneMarketplace,claude plugin marketplace add) already accept either form, so no further changes were needed.Test plan
go test -race ./...— full suite greengo vet ./internal/providers/claude/... ./internal/run/...— cleangofmt -l— clean on changed filesmoat claudein a project whose host~/.claude/remote-settings.jsoncontainsstrictKnownMarketplacesand confirm plugins install without "not in the allowed marketplace list" errorsmoat claudestill works for users withoutstrictKnownMarketplaces(no regression for the unconstrained path)